import 'dotenv/config'
import express from 'express'
import cors from 'cors'
import charactersRouter from './routes/characters.js'
import navlistRouter from './routes/navlist.js'
import cityRouter from './routes/city.js'
import { getPool } from './db.js'

const app = express()
app.use(cors())
app.use(express.json())

app.get('/api/ping', (req, res) => {
  res.json({ code: 0, msg: 'pong' })
})



app.use('/api', charactersRouter)
app.use('/api', navlistRouter)
app.use('/api', cityRouter)

const port = Number(process.env.PORT || 3000)
app.listen(port, () => {
  console.log(`[server] listening on http://localhost:${port}`)
})
